package cn.bdqn.service.impl;

import cn.bdqn.entity.Country;
import cn.bdqn.dao.CountryDao;
import cn.bdqn.service.CountryService;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;

@Service
public class CountryServiceImpl implements CountryService {
    @Resource
    private CountryDao countryDao;

    @Override
    public List<Country> queryAll() {
        return this.countryDao.queryAll();
    }
    
    @Override
    public Country queryById(Integer countryId) {
        return this.countryDao.queryById(countryId);
    }
    @Override
    public Country insert(Country country) {
        this.countryDao.insert(country);
        return country;
    }

    @Override
    public Country update(Country country) {
        this.countryDao.update(country);
        return this.queryById(country.getCountryId());
    }

    @Override
    public boolean deleteById(Integer countryId) {
        return this.countryDao.deleteById(countryId) > 0;
    }
}
